package com.fengmi.controller;

import com.fengmi.entity.cart.Cart;
import com.fengmi.entity.vo.ResultVO;
import com.fengmi.service.ICartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController
@RequestMapping("cart")
public class CartController {
    @Autowired
    private ICartService cartService;
    @RequestMapping("add")
    public ResultVO addCart(String skuId, Integer buyNum){
        return cartService.addCart(skuId,buyNum);
    }

    @RequestMapping("findCartList")
    public List<Cart> findCartList(){
        return cartService.findCartList();
    }

    @RequestMapping("delete")
    public ResultVO delete(String skuId){
        return cartService.delete(skuId);
    }

    @RequestMapping("jiesuan")
    public ResultVO jieSuan(@RequestBody List<Cart> cartList){
        return cartService.jieSuan(cartList);
    }
}
